@extends('layouts.admin')
@section('css')
    <style>
        .visible-lg{
            display: inline-block !important;
        }
    </style>
    <link href="{{ asset('static/toastr/toastr.css') }}" rel="stylesheet" type="text/css" />
@stop
@section('content')
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-lg-10 col-md-offset-2 main" id="main">
        <div class="row">
            <div class="col-md-5">
                <h1 class="page-header">添加</h1>
                <form action="{{url("admin/tag/store")}}" method="post" autocomplete="off">
                    {{ csrf_field() }}
                    <div class="form-group">
                        <label for="category-name">标签名称</label>
                        <input type="text" name="name" value="{{old('name')}}" class="form-control" placeholder="在此处输入标签名称" autocomplete="off">
                        <span class="prompt-text">这将是它在站点上显示的名字。</span> </div>

                    <button class="btn btn-primary" type="submit">添加新标签</button>
                </form>
            </div>
            <div class="col-md-7">
                <h1 class="page-header">管理 <span class="badge">{{count($tags)}}</span></h1>
                <div class="table-responsive">
                    <table class="table table-striped table-hover">
                        <thead>
                        <tr>
                            <th><span class="glyphicon glyphicon-paperclip"></span> <span class="visible-lg">ID</span></th>
                            <th><span class="glyphicon glyphicon-file"></span> <span class="visible-lg">名称</span></th>
                            <th><span class="glyphicon glyphicon-list-alt"></span> <span class="visible-lg">状态</span></th>
                            <th><span class="glyphicon glyphicon-pencil"></span> <span class="visible-lg">操作</span></th>
                        </tr>
                        </thead>
                        <tbody>
                        @if($tags)
                            @foreach($tags as $v)
                        <tr>
                            <td>{{$v->id}}</td>
                            <td>{{$v->name}}</td>
                            <td>@if(is_null($v->deleted_at))
                                    √
                                @else
                                    ×
                                @endif
                            </td>
                            <td><a href="{{url("admin/tag/edit",$v->id)}}">修改</a> <a href="{{url("admin/tag/destroy",$v->id)}}"  rel="1">删除</a></td>
                        </tr>
                        @endforeach
                        @endif
                        </tbody>
                    </table>
                    <span class="prompt-text"><strong>注：</strong>删除一个分类也会删除分类下的文章和子分类,请谨慎删除!</span> </div>
            </div>
        </div>
    </div>

    @section('js')
        <script src="{{ asset('static/toastr/toastr.js') }}"></script>
        <script>
        //错误提示
        @if ($errors->any())
            @foreach ($errors->all() as $error)
                toastr.error("{{$error}}")
            @endforeach
        @endif
        </script>
    @stop
@stop